#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=100000000,N=13,M=1<<13;;
int n,m,a[N][N];
ll f[N][M],b[M],cnt=0; 
int check(int S,int i){
	for(int j=0;j<m;j++){
//		if(a[i][j]==0&&(S>>(m-j-1))&1==1) return 0;
		if(a[i][j]==0&&(S>>j)&1==1) return 0;
	}
	return 1;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			scanf("%d",&a[i][j]);
	for(int i=0;i<(1<<m);i++){
		if(((i>>1)&i)||((i<<1)&i))
			continue;
		b[++cnt]=i;
	}
	for(int i=0;i<n;i++){
		if(i==0){
			for(int j=1;j<=cnt;j++){
				if(!check(b[j],i)) continue;
				f[i][b[j]]=1;
			}	
			continue;
		}
		for(int j=1;j<=cnt;j++){
			if(!check(b[j],i)) continue;
			for(int k=1;k<=cnt;k++){
				if(!check(b[k],i-1)) continue;
				if(b[j]&b[k]) continue;
				f[i][b[j]]=(f[i][b[j]]+f[i-1][b[k]])%mod;
			}
		}
	}
	ll ans=0; 
	for(int i=1;i<=cnt;i++){
		if(!check(b[i],n-1)) continue;
		ans=(ans+f[n-1][b[i]])%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

